<script>
import {mapGetters} from "vuex";

export default {
    name: "MyCart",
    computed:{
        ...mapGetters("cart",["sumPrice"]),
        ...mapGetters("cart",{
            sumPrice2:"sumPrice"
        })
    }
}
</script>
<template>
    <div>
        <h3 v-if="$store.state.cart.cartList.length===0">
            购物车空空如也！
        </h3>
        <template v-else>
            <div v-for="item in $store.state.cart.cartList" :key="item.goodsId">
                <p>商品名称：{{item.goodsName}}</p>
                <p>商品价格：{{item.goodsPrice | currency}}</p>
                <p>购买数量：{{item.buyNum}}</p>
                <hr/>
            </div>
            <h3>合计:{{$store.getters["cart/sumPrice"] | currency}}</h3>
            <h3>合计:{{sumPrice | currency}}</h3>
            <h3>合计:{{sumPrice2 | currency}}</h3>
        </template>


    </div>
</template>

<style scoped>

</style>